Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JDBC] Change default Precison and DisplaySize for all datetime types. #185

Merged
merged 2 commits into from
Dec 19, 2022

Conversation

Yury-Fridlyand
Copy link

Signed-off-by: Yury-Fridlyand yuryf@bitquilltech.com

Description

The proposed fix changes default Precision and DisplaySize configured for TIME and DATE types.

OpenSearchType(JDBCType jdbcType, Class<?> javaClass, int precision,
int displaySize, boolean isSigned) {

Precision is the third arg and DisplaySize is the fourth arg.


DATE(JDBCType.DATE, Date.class, 10, 10, false),
TIME(JDBCType.TIME, Time.class, 8, 8, false),

Please, note, classes referenced here ^ are java.sql.* classes, not java.time.* ones. Time has no fraction seconds part.

Test

Before
image

After
image

Issues Resolved

opensearch-project/sql-jdbc#21

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Yury-Fridlyand <yuryf@bitquilltech.com>
@codecov
Copy link

codecov bot commented Dec 9, 2022

Codecov Report

Merging #185 (6a495cb) into integ-fix-#923 (2af7321) will decrease coverage by 2.50%.
The diff coverage is n/a.

@@                 Coverage Diff                  @@
##             integ-fix-#923     opensearch-project/sql#185      +/-   ##
====================================================
- Coverage             98.30%   95.80%   -2.51%     
  Complexity             3518     3518              
====================================================
  Files                   342      352      +10     
  Lines                  8694     9352     +658     
  Branches                554      673     +119     
====================================================
+ Hits                   8547     8960     +413     
- Misses                  142      334     +192     
- Partials                  5       58      +53     
Flag Coverage Δ
query-workbench 62.76% <ø> (?)
sql-engine 98.30% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
workbench/public/components/app.tsx 0.00% <0.00%> (ø)
...ch/public/components/QueryResults/QueryResults.tsx 61.60% <0.00%> (ø)
workbench/public/components/SQLPage/SQLPage.tsx 100.00% <0.00%> (ø)
workbench/public/components/Main/main.tsx 53.00% <0.00%> (ø)
...ublic/components/QueryResults/QueryResultsBody.tsx 68.32% <0.00%> (ø)
workbench/public/utils/PanelWrapper.tsx 100.00% <0.00%> (ø)
...h/public/components/QueryLanguageSwitch/Switch.tsx 85.71% <0.00%> (ø)
workbench/public/application.tsx 0.00% <0.00%> (ø)
workbench/public/components/Header/Header.tsx 100.00% <0.00%> (ø)
workbench/public/components/PPLPage/PPLPage.tsx 56.52% <0.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Yury-Fridlyand Yury-Fridlyand changed the title Change default Precison and DisplaySize for TIME and DATE types. [JDBC] Change default Precison and DisplaySize for TIME and DATE types. Dec 9, 2022
@GabeFernandez310
Copy link

I just had a general question. What unit of measurement are precision and size (i.e., is it the number of bits, bytes, digits, etc... )?

@Yury-Fridlyand
Copy link
Author

I just had a general question. What unit of measurement are precision and size (i.e., is it the number of bits, bytes, digits, etc... )?

According to docs:

For datetime datatypes, this is the length in characters of the String representation (assuming the maximum allowed precision of the fractional seconds component)

DATE(JDBCType.DATE, Date.class, 24, 24, false),
TIME(JDBCType.TIME, Time.class, 24, 24, false),
DATE(JDBCType.DATE, Date.class, 10, 10, false),
TIME(JDBCType.TIME, Time.class, 8, 8, false),
DATETIME(JDBCType.TIMESTAMP, Timestamp.class, 24, 24, false),
TIMESTAMP(JDBCType.TIMESTAMP, Timestamp.class, 24, 24, false),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we update DATETIME and TIMESTAMP to a precision of 9?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks!

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
@Yury-Fridlyand Yury-Fridlyand changed the title [JDBC] Change default Precison and DisplaySize for TIME and DATE types. [JDBC] Change default Precison and DisplaySize for all datetime types. Dec 13, 2022
@Yury-Fridlyand Yury-Fridlyand merged commit b8af5a3 into integ-fix-#923 Dec 19, 2022
@Yury-Fridlyand Yury-Fridlyand deleted the dev-fix-#923 branch December 19, 2022 21:26
andy-k-improving pushed a commit that referenced this pull request Nov 16, 2024
Signed-off-by: Heemin Kim <heemin@amazon.com>

Signed-off-by: Heemin Kim <heemin@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants